package service

import (
	resource2 "awesomeTask/application/resource"
	"awesomeTask/application/variable"
	"awesomeTask/system/event"
	"awesomeTask/system/helper"
	"awesomeTask/system/kernel"
	resource3 "awesomeTask/system/resource"
)

type ResourceService struct {
}

func (ioc ResourceService) Register() {
	resource := resource3.ResourceManagerObj{
		ResourceDir: helper.GetCurrentRunningPath() + "/static/",
	}
	instance := kernel.GetIocInstance()
	instance.BindCreateObject("resource", func() interface{} {
		return resource
	}, true)

	event.Register(variable.ON_INSTALL_PACKAGE, func(args ...interface{}) {
		packageInfo := args[0].(map[string]interface{})
		packageName := packageInfo["package"].(string)
		projectPath := packageInfo["projectPath"].(string)
		resource2.InstallPacket(packageName, projectPath)
	})
}
func (ioc ResourceService) Boot() {

}
